extends "../aijier-3/aijier-3.gd"


var baseId = ""
func _extInit():
	._extInit()
	if isInManual():
		addSkill(sk3t1[1], sk3t1[0])
		addSkill(sk3t2[1], sk3t2[0])
	elif sk3 != 0:
		doChoiceSkill3()
	lv = 4             #等级的设置

var sk3t1 = ["噬啮之颚·1", "每10秒吸取当前目标20%的血量并嘲讽周围2格的敌人"]
var sk3t2 = ["噬啮之颚·2", "每10秒冲向血量最高的敌人身边，获得100%反伤并嘲讽周围(九宫格)的敌人"]

func doChoiceSkill3():
	if sk3 == 1:
		addSkill("每{cd}秒吸取当前目标20%的血量并嘲讽周围2格的敌人", sk3t1[0], "aijier41", 10)
	if sk3 == 2:
		addSkill("每{cd}秒冲向血量最高的敌人身边，获得100%反伤并嘲讽周围(九宫格)的敌人", sk3t2[0], "aijier42", 10)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "aijier41":	
		aijier41()
	if id == "aijier42":	
		aijier42()

func aijier41():
	var dmg = aiCha.att.maxHp*0.2
	if aiCha.type == sys.CharaClass.BOSS:
		dmg *= 0.2
	healCha(self, dmg)
	holyDmg(aiCha, dmg, "噬啮之颚")
	for cha in getCellChas(cell, 2, 1):
		cha.addBuff(buff.b_chaoFeng.new(5))
		cha.aiCha = self

func aijier42():
	var chas = getAllChas(1)
	chas.sort_custom(self, "sortByHpDesc")
	for cha in chas:
		if cha.isDeath || cha.isSumm:continue
		var mv = Vector2(cha.cell.x ,cha.cell.y)
		for i in config.aroundCellEx:
			var v = mv+i
			if matCha(v) == null and sys.main.isMatin(v) and setCell(v):
				var pos = sys.main.map.map_to_world(cell)
				ying(pos)
				position = pos
				aiCha = cha
				addBuff(buff.b_fanShang.new(1, 5))
				for j in getAroundChas(cell, false):
					j.addBuff(buff.b_chaoFeng.new(5))
					j.aiCha = self
				return

